<template>
	<view class="xb-page">
		<form @submit="formsubmit" @reset="formreset"></form>
		<view class="xb-page-section-title">基本信息</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker class="xb-select" mode=" selector" :range="studentList" @change="studentchange">学生列表</picker>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker v-model="formdata.rid" class="xb-select" mode="selector" :range="roomList" @change="clschange">教室</picker>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker v-model="formdata.subid" class="xb-select" mode=" selector" :range="subjectList" @change="subchange">课程</picker>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker class="xb-select" mode=" selector" :range="empList" @change="empchange">老师</picker>
			</view>
		</view>
		<view class="xb-page-section-title">课程时间</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker v-model="starttime" class="xb-select" mode=" date" start="2018-10-24">开课时间</picker>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker v-model="classtime" class="xb-select" mode="time">上课时间</picker>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<input v-model="durationtime" class="xb-input" placeholder-class="xb-input-placeholder" placeholder="上课时长" ></input>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker v-model="classtimeend" class="xb-select" mode="selector">下课时间</picker>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<view class="page-xb-form-title">扣课时间</view>
				<number-box class="xb-number-box xb-form-cell-border-grow1" step=1></number-box>
			</view>
		</view>
		<view class="xb-form-cell-border">
			<view class="xb-form-cell-border">
				<picker v-model="formdata.ptype" class="xb-select" mode=" selector" :range="periodruleList">循环排课</picker>
			</view>
		</view>
		<view class="xb-page-section-title">课程主题</view>
		<view class="xb-form-cell-border">
			<textarea v-model="formdata.comments" style="height: 400px;" placeholder-class="xb-input-placeholder "></textarea>
		</view>
		<view class="uni-flex uni-row xb-button-cell">
			<button class="xb-button"></button>
		</view>
	</view>
</template>

<script>
	import pageHead from '../../../components/page-head.vue'
	import numberBox from '../../../components/number-box.vue'
	import {
		addclsonetoone
	} from '../../../api/getData.js'
	export default {
	  computed: {
              ...mapGetters([''])
         },
		components:{
			numberBox,
			pageHead,
		},
		data() {
			return {
				formdata: {
					durationtime:0,
					classtime:0,
					classtimeend:0,
					ptype:'',
					comments:'',
				}

			}
		},
		methods: {
		…mapMutations(['']),
...mapActions(['']),
			//提交一对一创建
			async formsubmit() {
				const res = await addonetoone(formdata);
				if (res.success == true) {
					//后退一个页面
					uni.navigateBack({
						delta: 1
					})
				} else {


				}

			},
			initData() {
				let data = formData;
				uni.request({
					url: '/api/',
					method: 'POST',
					data: data,
					success: (data) => {
						uni.stopPullDownRefresh();
						if (data.statusCode == 200) {

						}
					},
					fail: (data, code) => {
						console.log('fail' + JSON.stringify(data));
					}
				})
			},

		}
	}
</script>
<style scoped >
	@import "../../../common/uni.css";
	@import "../../../common/xb.css";
	.page-xb-form-title {
		color: #999999;
		font-size: 30px;
	}
</style>
